...upon receiving onbeforeunload from PPro.
[This page will auto-close in 10 seconds.]
This would be a great time for your panel to close any open sockets, sign out of databases, and perform any other pre-shutdown cleanup you may want to do.
There are some restrictions: not all of CSInterface is available, and you can't pop any alerts.